import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    name: 'layout',
    component: () => import('../layout/Layout'),
    children:[
      {
        path: '',
        name: 'questionlist',
        component: () => import('../views/QuestionList')
      },
      {
        path: 'askquestions',
        name: 'askquestions',
        component: () => import('../views/AskQuestions')
      },
      {
        path: 'addquestion',
        name: 'addquestion',
        component: () => import('../views/AddQuestion')
      },
      {
        path: 'questionlist',
        name: 'questionlist',
        component: () => import('../views/QuestionList')
      },
    ]
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
